//cookie的封装

function setCookie(name,value,iDay,path){
	var path = path || '/';
	if( iDay ){
		var now = new Date();
		now.setDate(now.getDate()+iDay);
	
		value = encodeURIComponent(value);
		document.cookie = name+"="+value+";expires="+now+";path="+path;
	}else{
		value = encodeURIComponent(value);
		document.cookie = name+"="+value+";path="+path;
	}
	
}


//获取cookie函数

function getCookie(name){
	cookie = decodeURIComponent(document.cookie);
	var arr = cookie.split("; ");
	for( var i = 0 ; i < arr.length ; i++){
		var arr1 = arr[i].split("=");
		if( arr1[0] == name ){
			return arr1[1];
		}
	}
}


//删除cookie函数

function removeCookie(name){
	setCookie(name,1,-100)
}
